import random

import numpy as np
import pandas as pd
from netZooPy.ligress.bonobo import Bonobo
from bonobo_competitors_scaled import lioness
from bonobo_competitors_scaled import spcc
from bonobo_competitors_scaled import sweet
from bonobo_simulation_module_timer import simulate_bonobo

random.seed(10)

### Compute MSE for Nsim-many Simulated Data
sim_mean = pd.read_csv("/home/esaha/BONOBO/data/simulation_simple/simulation_mean1000.csv")
sim_cov = pd.read_csv("/home/esaha/BONOBO/data/simulation_simple/simulation_covariance1000.csv", sep = " ")

Nsim = 100
nsample = 100
ngene = 1000
t_bonobo = []
t_bonobo_sparse = []
t_lioness = []
t_spcc = []
t_sweet = []
for i in range(Nsim):
  t_b, t_bs, t_l, t_s, t_sw = simulate_bonobo(sim_mean, sim_cov, ngene, nsample, nsample_ind = 100)
  t_bonobo.append(t_b)
  t_bonobo_sparse.append(t_bs)
  t_lioness.append(t_l)
  t_spcc.append(t_s)
  t_sweet.append(t_sw)

# Combine the lists using pandas
results = pd.DataFrame({
    "time_bonobo": t_bonobo,
    "time_bonobo_sparse": t_bonobo_sparse,
    "time_lioness": t_lioness,
    "time_spcc": t_spcc,
    "time_sweet": t_sweet
})

# Save the combined DataFrame to a text file
results.to_csv("timer_bonobo_simulation_scaledCompetitors_sample" + str(nsample) + "_gene"+ str(ngene) +".txt", sep="\t", index=False)

results.mean(axis=0)



